home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / CHSSLink.bas < prev    next >
Encoding:
BASIC Source File  |  1997-11-07  |  1.6 KB  |  67 lines

  1. Attribute VB_Name = "CommonCode"
  2. Option Explicit
  3.  
  4. Global GlobalObjID&
  5. Global ChartOnSheet As Boolean
  6.  
  7.  
  8. Sub ClearChartMenuChecks()
  9.  
  10.    MDIForm1.mnuChart2DBar.Checked = False
  11.    MDIForm1.mnuChart3DBar.Checked = False
  12.    MDIForm1.mnuChart2DPie.Checked = False
  13.    MDIForm1.mnuChart3DPie.Checked = False
  14.    
  15.    Call MoveChartPictureToSheet
  16.     
  17. End Sub
  18.  
  19. Sub MoveChartPictureToSheet()
  20.  
  21. #If Win32 Then
  22.    Dim metafile&
  23. #Else
  24.    Dim metafile%
  25. #End If
  26.  
  27.    Dim MapMode%, ObjID&
  28.    Dim X1!, Y1!, X2!, Y2!
  29.    Dim ExtentX&, ExtentY&
  30.    
  31.    ' If the chart is on the sheet then update it
  32.    If MDIForm1.chkLink.Value = 1 Then
  33.    
  34.       ' Get the metafile from the chart
  35.       ChartForm.VtChart1.GetMetafile VtPictureOptionNoSizeHeader, metafile, ExtentX, ExtentY
  36.    
  37.       ' Put metafile into existing object on sheet
  38.       MapMode = 8 ' Anisotropic Mode (Stretchable)
  39.       SheetForm.F1Book1.ObjSetPicture GlobalObjID, metafile, MapMode, ExtentX, ExtentY
  40.    
  41.    End If
  42.  
  43. End Sub
  44.  
  45. Sub ResizeArea()
  46.  
  47.    Dim Buffer$
  48.    
  49.    ' Get the last row and last column of the worksheet
  50.    ' and create a Formula One reference
  51.    With SheetForm.F1Book1
  52.       If .LastRow = 0 Or .LastCol = 0 Then
  53.         MsgBox "You must enter data into the sheet"
  54.         MDIForm1.chkLink.Value = 0
  55.         Exit Sub
  56.       End If
  57.       Let Buffer = "A1:" & .FormatRCNr(.LastRow, .LastCol, False)
  58.    End With
  59.    
  60.    ' Tell First Impression charting the worksheet, range, and parse method
  61.    ChartForm.VtChart1.SsLinkSheet = SheetForm.F1Book1.TableName
  62.    ChartForm.VtChart1.SsLinkRange = Buffer
  63.    ChartForm.VtChart1.SsLinkMode = VtChSsLinkModeAutoParse
  64.  
  65. End Sub
  66.  
  67.